package com.yungu.swift.schedule.job;

import com.yungu.swift.schedule.service.impl.MarketingActivityQuartzService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.PersistJobDataAfterExecution;
import org.springframework.scheduling.quartz.QuartzJobBean;

import static com.yungu.swift.schedule.utils.QuartzContextUtils.getApplicationContext;

/**
 * @author : cuixiuyin
 * @date : 2019/8/14
 */
@PersistJobDataAfterExecution
// 不允许并发执行
@DisallowConcurrentExecution
public class ActivityQuartzJob extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        MarketingActivityQuartzService activityQuartzService = getApplicationContext(jobExecutionContext).getBean(
                MarketingActivityQuartzService.class);
        activityQuartzService.activityQuartz();
    }

}
